package com.web.listeners.imp;

import java.lang.reflect.Field;

import com.app.AnnFieldPopulator;
import com.zyncro.user.User;
import com.zyncro.user.ZyncroUser;
import com.zyncro.user.ZyncroUserFactory;

public class UserPopulator extends AnnFieldPopulator<ZyncroUser, User>{

	private ZyncroUserFactory userFactory;
	
	public UserPopulator(ZyncroUserFactory userFactory) {
		super(User.class);
		
		this.userFactory = userFactory;
	}

	@Override
	protected ZyncroUser newFieldValue(Field field, User annotation) {
		
		String userId = annotation.id();
		ZyncroUser userInstance = userFactory.getUser(userId);
		
		return userInstance;
	}

}
